;
var mypost = {
    init: function () {
        this.eventBind()
    },
    eventBind: function () {
        $(".do-post").click(function () {

            var btnaction = $(this);
            if (btnaction.hasClass("disable")) {
                common_ops.alert("还没提交上去了，别瞎点")
                return
            }

            var listtask = $(".title select[name=task]").val();
            var classone = $(".form select[name=classone]").val();
            var classtwo = $(".form select[name=classtwo]").val();
            var listremark = $(".form textarea[name=remark]").val();
            var listdata = $(".form input[name=datatime]").val();
            var weight = $(".form input[name=weight]").val();
            var listcontent = "为" + classtwo + "处理" + classone + "类故障";
            var method = "post"
            var type = "itfix";


            $.ajax({
                url: common_ops.buildUrl("/work/itfix"),
                type: "POST",
                data: {

                    listdata: listdata,
                    listcontent: listcontent,
                    listtask: listtask,
                    listremark: listremark,
                    type: type,
                    method: method,
                    weight: weight,
                    classone: classone,
                    classtwo: classtwo,

                },
                dataType: 'json',
                success: function (res) {
                    btnaction.removeClass("disabled");
                    var callback = null;
                    if (res.code == 200) {
                        callback = function () {
                            window.location.href = common_ops.buildUrl("/work/index");
                        };
                    }
                    common_ops.alert(res.msg, callback);
                }
            });

        });
    }
};
$(document).ready(function () {
    mypost.init();
});

var myupdata = {
    init: function () {
        this.eventBind()
    },
    eventBind: function () {
        $(".do-updata").click(function () {
            var btnaction = $(this);
            if (btnaction.hasClass("disable")) {
                common_ops.alert("还没提交上去了，别瞎点")
                return
            }


            var classone = $("select[name=classone]").val();
            var classtwo = $("select[name=classtwo]").val();
            var listremark = $("textarea[name=remark]").val();
            var listdata = $("input[name=datatime]").val();
            var weight = $("input[name=weight]").val();
            var updataid = $("input[name=updataid]").val();
            var listcontent = "为" + classtwo + "处理" + classone + "类故障";
            var method = "updata";


            $.ajax({
                url: common_ops.buildUrl("/work/changetask"),
                type: "POST",
                data: {
                    listdata: listdata,
                    listcontent: listcontent,
                    listremark: listremark,
                    method: method,
                    weight: weight,
                    classone: classone,
                    classtwo: classtwo,
                    updataid: updataid,
                },
                dataType: 'json',
                success: function (res) {
                    btnaction.removeClass("disabled");
                    var callback = null;
                    if (res.code == 200) {
                        callback = function () {
                            window.location.href = common_ops.buildUrl("/work/index");
                        };
                    }
                    common_ops.alert(res.msg, callback);
                }
            });

        });
    }
};
$(document).ready(function () {
    myupdata.init();
});